package com.street.service.impl;

import com.street.context.BaseContext;
import com.street.dto.ShopDTO;
import com.street.entity.Shop;
import com.street.mapper.ShopMapper;
import com.street.service.ShopService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ShopServiceImpl implements ShopService {
    @Autowired
    private ShopMapper shopMapper;

    @Override
    public List<Shop> list() {
        List<Shop>list =shopMapper.selectShop();
        return list;
    }

    @Override
    public Shop getShopDetail(Long shopId) {
        Shop shop=shopMapper.selectByShopId(shopId);
        return shop;
    }

    @Override
    public void updateShop(ShopDTO shopDTO) {
        Shop shop=new Shop();
        BeanUtils.copyProperties(shopDTO,shop);
        shopMapper.updateShop(shop);
        return;
    }

    @Override
    public void changeStatus(Integer status, Integer shopId) {
        shopMapper.changeStatus(status, shopId);
    }

}
